// -------------------------------------------------------------------------
// DYNAMIC PRESET MODULE
// -------------------------------------------------------------------------
// Each preset is a colour-correction matrix (3x float4 RGB rows) plus
// luma/chroma multipliers.  The matrix is applied as:
//   color.rgb = mul(color, float3x3(rowR.rgb, rowG.rgb, rowB.rgb))
// followed by AdjustLumaChroma(luma, chroma) and AdjustContrast.
//
// Row layout: float4(selfGain, crossR, crossG, 1.0)
//   rowR = how much R, G, B each contribute to the output Red channel
//   rowG = how much R, G, B each contribute to the output Green channel
//   rowB = how much R, G, B each contribute to the output Blue channel
//
// Presets 6 and 7 are locked -- do not touch.
// -------------------------------------------------------------------------

void GetDynamicPresetValues(int presetID,
                            out float4 redCh,
                            out float4 greenCh,
                            out float4 blueCh,
                            out float luma,
                            out float chroma)
{
    // Identity fallback
    redCh   = float4(1.0, 0.0, 0.0, 1.0);
    greenCh = float4(0.0, 1.0, 0.0, 1.0);
    blueCh  = float4(0.0, 0.0, 1.0, 1.0);
    luma    = 1.0;
    chroma  = 1.0;

    if (presetID == 1)
    { // Neutral+
      // Clean identity with a very slight contrast push.
      // Good baseline when you want the tonemapper to do most of the work
      // without any colour skew. Luma and chroma stay at 1.0 so nothing
      // is crushed or boosted -- the matrix is a hair away from identity,
      // just enough to tighten blacks via the negative cross-bleed.
        redCh   = float4(1.02,  0.00,  0.00, 1.0);
        greenCh = float4(0.00,  1.02,  0.00, 1.0);
        blueCh  = float4(0.00,  0.00,  1.02, 1.0);
        luma    = 1.00;
        chroma  = 1.00;
    }
    else if (presetID == 2)
    { // Cinematic Teal & Orange
      // The most common Hollywood grade: skin/metal tones pushed warm
      // (orange), shadows and midtones pushed cool (teal/blue-green).
      // Red channel leans warm, blue channel pulls teal into shadows.
        redCh   = float4(1.05,  0.00, -0.05, 1.0);
        greenCh = float4(0.00,  0.95,  0.05, 1.0);
        blueCh  = float4(-0.05, 0.08,  1.00, 1.0);
        luma    = 1.00;
        chroma  = 1.10;
    }
    else if (presetID == 3)
    { // Cold Night
      // Blue-shifted with desaturated midtones. Works well for night
      // racing -- asphalt looks wet, streetlamps punch through.
      // Green is pulled slightly toward cyan, red is slightly crushed.
        redCh   = float4(0.88,  0.00,  0.05, 1.0);
        greenCh = float4(0.00,  0.92,  0.08, 1.0);
        blueCh  = float4(0.00,  0.00,  1.12, 1.0);
        luma    = 0.95;
        chroma  = 0.85;
    }
    else if (presetID == 4)
    { // Golden Hour
      // Warm late-afternoon light. Reds and yellows lifted, blue shadows
      // cooled slightly to complement. High chroma makes paint pop.
      // The green->red bleed (+0.08) gives skin/chrome a golden cast.
        redCh   = float4(1.08,  0.08,  0.00, 1.0);
        greenCh = float4(0.00,  1.00,  0.00, 1.0);
        blueCh  = float4(0.00,  0.00,  0.88, 1.0);
        luma    = 1.05;
        chroma  = 1.15;
    }
    else if (presetID == 5)
    { // Bleach Bypass
      // Film bleach bypass: silver retention causes desaturation with
      // elevated contrast and luminance. Blacks crush hard, highlights
      // stay bright. Cross-matrix kept near identity to avoid hue shift.
        redCh   = float4(0.95,  0.025, 0.025, 1.0);
        greenCh = float4(0.025, 0.95,  0.025, 1.0);
        blueCh  = float4(0.025, 0.025, 0.95,  1.0);
        luma    = 1.10;
        chroma  = 0.60;
    }

    // ── LOCKED: DO NOT MODIFY ─────────────────────────────────────────────
    else if (presetID == 6)
    { // NFS MostWanted (Yellow/Green Tint)
        redCh   = float4(0.95, 0.05, 0.00, 1.0);
        greenCh = float4(0.05, 0.95, 0.00, 1.0);
        blueCh  = float4(0.00, 0.00, 1.00, 1.0);
        luma    = 1.00;
        chroma  = 1.05;
    }
    else if (presetID == 7)
    { // NFS Carbon Canyon (Cold Blue)
        redCh   = float4(0.85, 0.00, 0.15, 1.0);
        greenCh = float4(0.00, 0.90, 0.10, 1.0);
        blueCh  = float4(0.00, 0.00, 1.10, 1.0);
        luma    = 0.90;
        chroma  = 0.80;
    }
    // ── END LOCKED ────────────────────────────────────────────────────────

    else if (presetID == 8)
    { // Overcast
      // Flat, overcast-sky look. Grey light, no strong colour cast.
      // Useful for foggy or rainy environments where vibrant grading
      // would look wrong. Matrix is near-identity, chroma is pulled back.
        redCh   = float4(0.96, 0.02, 0.02, 1.0);
        greenCh = float4(0.02, 0.96, 0.02, 1.0);
        blueCh  = float4(0.02, 0.02, 0.96, 1.0);
        luma    = 0.98;
        chroma  = 0.80;
    }
    else if (presetID == 9)
    { // High Contrast
      // Lifted contrast via negative cross-bleed (channels repel each
      // other). Result: punchy, saturated colours with crushed blacks.
      // Similar to a filmic S-curve baked into the matrix.
        redCh   = float4(1.05, -0.03, -0.03, 1.0);
        greenCh = float4(-0.03, 1.05, -0.03, 1.0);
        blueCh  = float4(-0.03, -0.03, 1.05, 1.0);
        luma    = 1.00;
        chroma  = 1.20;
    }
    else if (presetID == 10)
    { // Vintage Film
      // Faded, slightly yellow-green cast reminiscent of old photographic
      // print stock. Blacks lift (via positive cross bleed), highlight
      // saturation drops. Luma slightly boosted to stop it looking dark.
        redCh   = float4(0.90,  0.08,  0.05, 1.0);
        greenCh = float4(0.05,  0.90,  0.05, 1.0);
        blueCh  = float4(0.10,  0.05,  0.80, 1.0);
        luma    = 1.05;
        chroma  = 0.80;
    }
    else if (presetID == 11)
    { // Neon Night
      // Strong cyan-magenta split for neon-lit urban environments.
      // Reds pushed magenta (red + blue), greens held, blues shifted cyan.
      // High chroma -- intended for night gameplay only.
        redCh   = float4(1.05,  0.00,  0.08, 1.0);
        greenCh = float4(0.00,  0.95,  0.05, 1.0);
        blueCh  = float4(0.00,  0.08,  1.08, 1.0);
        luma    = 0.95;
        chroma  = 1.25;
    }
    else if (presetID == 12)
    { // Cross Process
      // Simulates E-6 slide film developed in C-41 chemistry.
      // Characteristic look: cyan shadows, yellow-green midtones,
      // red highlights. Achieved by pushing channels in opposite
      // directions in the low vs high range -- approximated here by
      // asymmetric cross-bleed per channel.
        redCh   = float4(1.10, -0.05,  0.00, 1.0);
        greenCh = float4(0.00,  0.90,  0.10, 1.0);
        blueCh  = float4(0.10,  0.00,  0.95, 1.0);
        luma    = 1.00;
        chroma  = 1.15;
    }
    else if (presetID == 13)
    { // Desert Dust
      // Warm sandy haze. Yellow-orange cast across the board, blue channel
      // pulled back hard. Works well for daytime canyon or desert tracks.
        redCh   = float4(1.05,  0.05,  0.00, 1.0);
        greenCh = float4(0.05,  1.00,  0.00, 1.0);
        blueCh  = float4(0.05,  0.05,  0.80, 1.0);
        luma    = 1.05;
        chroma  = 1.05;
    }
    else if (presetID == 14)
    { // Teal Shadows
      // Selective teal push in darker tones via blue-green cross bleed.
      // Highlights stay warm (low blue->red bleed). Common in action
      // cinematography to give depth separation.
        redCh   = float4(1.00,  0.00, -0.05, 1.0);
        greenCh = float4(0.00,  1.00,  0.00, 1.0);
        blueCh  = float4(0.00,  0.12,  1.00, 1.0);
        luma    = 1.00;
        chroma  = 1.05;
    }
    else if (presetID == 15)
    { // Washed Out
      // Matte/faded look. Positive cross-bleed lifts all channels into
      // each other, destroying black depth. Combined with chroma pull-back
      // gives the "Instagram faded" aesthetic. Intentionally low contrast.
        redCh   = float4(0.85,  0.08,  0.08, 1.0);
        greenCh = float4(0.08,  0.85,  0.08, 1.0);
        blueCh  = float4(0.08,  0.08,  0.85, 1.0);
        luma    = 1.05;
        chroma  = 0.70;
    }
    else if (presetID == 16)
    { // Deep Forest
      // Green-dominant, slightly cold. Evokes dense foliage or rain-forest
      // environments. Red pulled back, green boosted, blue given a slight
      // cyan lean via green->blue bleed.
        redCh   = float4(0.88,  0.00,  0.00, 1.0);
        greenCh = float4(0.05,  1.08,  0.00, 1.0);
        blueCh  = float4(0.00,  0.08,  1.00, 1.0);
        luma    = 0.98;
        chroma  = 1.05;
    }
    else if (presetID == 17)
    { // Infrared
      // Simulates colour infrared film. Foliage (high green reflectance)
      // renders bright, skies and roads render dark or magenta. Achieved
      // by swapping green and red gain with strong cross-bleed inversion.
        redCh   = float4(0.20,  0.80,  0.00, 1.0);
        greenCh = float4(0.80,  0.20,  0.00, 1.0);
        blueCh  = float4(0.00,  0.00,  1.10, 1.0);
        luma    = 1.00;
        chroma  = 1.10;
    }
    else if (presetID == 18)
    { // Broadcast TV
      // Mimics the colour profile of a broadcast camera monitor:
      // slightly boosted saturation and contrast, mild red push for skin
      // warmth, blue rolled off. Clean and authoritative.
        redCh   = float4(1.05,  0.00,  0.00, 1.0);
        greenCh = float4(0.00,  1.00,  0.00, 1.0);
        blueCh  = float4(0.00,  0.00,  0.92, 1.0);
        luma    = 1.00;
        chroma  = 1.15;
    }
    else if (presetID == 19)
    { // Monochrome Tint
      // Near-greyscale with a configurable colour lean. The matrix
      // collapses all channels toward luminance (NTSC weights approx.),
      // then a slight blue-cyan tint is re-introduced to avoid a flat
      // grey. For a different tint, adjust the blueCh self-gain.
        redCh   = float4(0.33,  0.34,  0.33, 1.0);
        greenCh = float4(0.33,  0.34,  0.33, 1.0);
        blueCh  = float4(0.30,  0.30,  0.40, 1.0);
        luma    = 1.00;
        chroma  = 0.20;
    }
}
